package com.thekernel.youdaoyun.controller;

import com.alibaba.fastjson.JSONObject;
import com.thekernel.youdaoyun.YoudaoyunApplication;
import com.thekernel.youdaoyun.bean.Note;
import com.thekernel.youdaoyun.exception.MyException;
import com.thekernel.youdaoyun.util.ResponseUtils;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @Author TheKernel
 * @Date 2019/9/16 3:02 下午
 * @Version 1.0
 * @Description
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = YoudaoyunApplication.class)
public class testNoteController {

    @Autowired
    private NoteController noteController;

    @Test
    public void testUpdateNote() throws MyException {
        int noteId = 1;
        JSONObject data = JSONObject.parseObject(this.noteController.queryNote(noteId));
        JSONObject noteData = (JSONObject) data.get("data");
        Note note = JSONObject.toJavaObject((JSONObject) noteData.get("data"), Note.class);
        note.setNoteSecret("006600");

//        String result = this.noteController.updateNoteContent();
//        Assert.assertEquals((int) JSONObject.parseObject(result).get("code"), ResponseUtils.SUCCESS);
    }

}
